const path = require('path');
const webpack = require('webpack'); // 访问内置的插件
const HtmlWebpackPlugin = require('html-webpack-plugin'); // 通过 npm 安装


module.exports = {
    //入口文件
    entry: './src/index.js',
    //输出
    output: {
        path: path.resolve(__dirname, 'dist'),//输出目录
        filename: 'bundle.js',//文件名
    },
    module: {
        rules: [
            {test:/\.css$/,use:['style-loader','css-loader']},
            {test:/\.less$/,use:['style-loader','css-loader','less-loader']},//less的loader
            {test:/\.scss$/,use:['style-loader','css-loader','sass-loader']}//scss的loader
        ],
    },
    plugins: [
        new webpack.ProgressPlugin(),
        new HtmlWebpackPlugin({ template: './index.html' }),//在dist生成index.html
    ],
};